/*
 * @Author: guxf
 * @Date: 2021-11-25 12:47:22
 * @Description: 用户相关接口
 */
import request from "@/utils/request.js";
const api = {
	page: '/applet/order/page',
	pay: '/applet/order/payOrder',
	staffPage: '/merchant/staff/staffPage',
	deleteById: '/merchant/goods/',
	// 订单查询
	orderId: '/merchant/order/page',
	dispatchHandle: '/merchant/order/dispatchHandle',
	finishHandle: '/applet/order/completeOrder/',
	getInfo: '/applet/order/',
	subOrder: '/applet/order/submitOrder'
}

export function subOrder(parameter) {
	return request({
		url: api.subOrder,
		method: 'post',
		data: parameter
	})
}
//订单查询
export function searchOrder(parameter) {
	return request({
		url: api.orderId,
		method: 'post',
		data: parameter
	})
}
export function pay(parameter) {
	return request({
		url: api.pay,
		method: 'post',
		data: parameter
	})
}
export function getInfo(id) {
	return request({
		url: api.getInfo + id,
		method: 'GET'
	})
}
export function page(parameter) {
	return request({
		url: api.page,
		method: 'post',
		data: parameter
	})
}
export function staffPage(parameter) {
	return request({
		url: api.staffPage,
		method: 'post',
		data: parameter
	})
}
/**
 * @desc 新增或刪除
 */
export function addOrUpdate(data) {
	return request({
		method: "POST",
		url: '/applet/order/addOrUpdate',
		data,
	});
}
export function deleteById(parameter) {
	return request({
		method: "delete",
		url: api.deleteById + parameter,
	});
}

/**
 * @desc 订单操作
 */
export function dispatchHandle(data) {
	return request({
		method: "POST",
		url: api.dispatchHandle,
		data,
	});
}
/**
 * @desc 订单完成操作
 */
export function finishHandle(data) {
	return request({
		method: "GET",
		url: api.finishHandle+data
	});
}